require 'fileutils'
require 'project'

class Coverage
	include Generator
	
	def run()
		have = %w[ FALSE TRUE ]
		files = Dir.glob( "../../components/system/temp/test-reference/doc/*_terms.rb" )
		files.each do |file|
			text = read_file( file )
			lines = text.split( "\n" )
			lines.each do |line|
				have += line.scan( /^terms << '(.*)'$/ ).map { |g| g[0] }
			end
		end
		have.sort!
		have.uniq!

		[ [@small, "small"], [@medium, "medium"], [@large, "large"], [@jedox, "jedox"]].each do |want, name|
			sub = want - @toolpak
			miss = sub - have
			write_file "../../temp/rextile/contribute/hacking/nyi_#{name}.inc", miss.join( "; " )
			sub = want - sub
			miss = sub - have
			write_file "../../temp/rextile/contribute/hacking/nyi_#{name}_toolpak.inc", miss.join( "; " )
		end
	end
		
	def initialize
		@toolpak = %w[ EOMONTH NETWORKDAYS WEEKNUM WORKDAY YEARFRAC
			DOLLARDE DOLLARFR DATEDIF 
			ACCRINT ACCRINTM COUPDAYBS COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD CUMIPMT 
			CUMPRINC DISC DURATION INTRATE MDURATION NOMINAL ODDFPRICE ODDFYIELD ODDLPRICE 
			ODDLYIELD PRICE PRICEMAT RECEIVED TBILLEQ TBILLPRICE TBILLYIELD XIRR XNPV YIELD YIELDDISC 
			YIELDMAT
			GCD ISEVEN ISODD MROUND MULTINOMIAL PERMUT QUOTIENT RANDBETWEEN SQRTPI SERIESSUM 
			BESSELI BESSELJ BESSELK BESSELY ERF ERFC ].sort.uniq
		@small = %w[ ABS ACOS AND ASIN ATAN ATAN2 AVERAGE CHOOSE COLUMNS COS COUNT COUNTA 
			COUNTBLANK COUNTIF DATE DAVERAGE DAY DCOUNT DCOUNTA DDB DEGREES DGET DMAX DMIN 
			DPRODUCT DSTDEV DSTDEVP DSUM DVAR DVARP EVEN EXACT EXP FACT FALSE FIND FV HLOOKUP 
			HOUR IF INDEX INT IRR ISBLANK ISERR ISERROR ISLOGICAL ISNA ISNONTEXT ISNUMBER ISTEXT LEFT 
			LEN LN LOG LOG10 LOWER MATCH MAX MID MIN MINUTE MOD MONTH N NA NOT NOW NPER NPV 
			ODD OR PI PMT POWER PRODUCT PROPER PV RADIANS RATE REPLACE REPT RIGHT ROUND ROWS 
			SECOND SIN SLN SQRT STDEV STDEVP SUBSTITUTE SUM SUMIF SYD T TAN TIME TODAY TRIM TRUE 
			TRUNC UPPER VALUE VAR VARP VLOOKUP WEEKDAY YEAR ].sort
		@medium = %w[ ACCRINT ACCRINTM ACOSH ADDRESS ASINH ATANH AVEDEV BESSELI BESSELJ 
			BESSELK BESSELY BETADIST BETAINV BINOMDIST CEILING CELL CHAR CHIDIST CHIINV CHITEST 
			CLEAN CODE COLUMN COMBIN CONCATENATE CONFIDENCE CONVERT CORREL COSH COUPDAYBS 
			COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD COVAR CRITBINOM CUMIPMT CUMPRINC 
			DATEDIF DATEVALUE DAYS360 DB DEVSQ DISC DOLLAR DOLLARDE DOLLARFR DURATION EOMONTH 
			ERF ERFC EXPONDIST FDIST FINV FISHER FISHERINV FIXED FLOOR FORECAST FTEST GAMMADIST 
			GAMMAINV GAMMALN GCD GEOMEAN HARMEAN HYPGEOMDIST INTERCEPT INTRATE ISEVEN ISODD 
			KURT LARGE LCM LINEST LOGINV LOGNORMDIST LOOKUP MDURATION MEDIAN MINVERSE MIRR MMULT 
			MODE MROUND MULTINOMIAL NEGBINOMDIST NETWORKDAYS NOMINAL NORMDIST NORMINV 
			NORMSDIST NORMSINV ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD OFFSET PEARSON PERCENTILE 
			PERCENTRANK PERMUT POISSON PRICE PRICEMAT PROB QUARTILE QUOTIENT RAND RANDBETWEEN 
			RANK RECEIVED ROMAN ROUNDDOWN ROUNDUP ROW RSQ SERIESSUM SIGN SINH SKEW SLOPE 
			SMALL SQRTPI STANDARDIZE STDEVPA STEYX SUBTOTAL SUMPRODUCT SUMSQ SUMX2MY2 
			SUMX2PY2 SUMXMY2 TANH TBILLEQ TBILLPRICE TBILLYIELD TDIST TIMEVALUE TINV TRANSPOSE TREND 
			TRIMMEAN TTEST TYPE VARA VDB WEEKNUM WEIBULL WORKDAY XIRR XNPV YEARFRAC YIELD YIELDDISC 
			YIELDMAT ZTEST ].sort
		@large = %w[ ACOT ACOTH AMORDEGRC AMORLINC ARABIC AREAS ASC AVERAGEA B BAHTTEXT BASE 
			BIN2DEC BIN2HEX BIN2OCT BITAND BITLSHIFT BITOR BITRSHIFT BITXORCEILING COMBINA COMPLEX 
			COT COTH CURRENT DAYS DBSC DDE DEC2BIN DEC2HEX DEC2OCT DECIMAL DELTA EDATE EFFECT 
			EFFECTIVE ERROR.TYPE FACTDOUBLE FINDB FORMULA FREQUENCY FVSCHEDULE GAMMA GAUSS 
			GESTEP GETPIVOTDATA GROWTH HEX2BIN HEX2DEC HEX2OCT HYPERLINK HYPGEOMVERT IMABS 
			IMAGINARY IMARGUMENT IMCONJUGATE IMCOS IMDIV IMEXP IMLN IMLOG10 IMLOG2 IMPOWER 
			IMPRODUCT IMREAL IMSIN IMSQRT IMSUB IMSUM INDIRECT INFO IPMT ISFORMULA ISPMT ISREF LEFTB 
			LENB MAXA MDETERM MUNIT MIDB MINA MNORMSINV NUMBERSTRING OCT2BIN OCT2DEC OCT2HEX 
			PERMUTATIONA PHI PHONETIC PPMT PRICEDISC REPLACEB RIGHTB RRI RTD SEARCH SEARCHB SHEET 
			SHEETS TEXT USDOLLAR VALUEL VARPA XOR ].sort
		@jedox = %w[ 
			ABS 
			ACOS 
			AND 
			ASIN 
			ATAN 
			AVERAGE 
			CEILING 
			CHAR 
			CHECKBOX 
			CODE 
			CHOOSE 
			COS 
			COUNTIF 
			COUNT 
			COUNTA 
			CONCATENATE 
			DATE 
			DATEVALUE 
			DAY 
			DB 
			DDB 
			EXACT 
			EXP 
			EOMONTH 
			FIND 
			FLOOR 
			FIXED 
			FLOOR 
			FV 
			HYPERLINK 
			HOUR 
			IF 
			INDEX 
			INT 
			INTERCEPT 
			IPMT 
			IRR 
			ISERR 
			ISERROR 
			ISNUMBER 
			ISNUMERIC 
			ISREF 
			ISTEXT 
			LARGE 
			LEFT 
			LEN 
			LIN 
			LOG 
			LOOKUP 
			LOWER 
			MATCH 
			MAX 
			MEDIAN 
			MIN 
			MIRR 
			MAX 
			MOD 
			MINUTE 
			MONTH 
			MROUND 
			MOD 
			MONTH 
			NOT 
			NOW 
			NPER 
			NPV 
			OFFSET
			OR 
			PI 
			PMT 
			POWER 
			PPMT 
			PRODUCT
			PROPER 
			PV 
			RANK 
			RATE 
			REPLACE 
			REPT 
			RIGHT 
			RMZ 
			ROUND 
			ROUNDDOWN
			ROUNDUP 
			SEARCH 
			SIGN 
			SLN 
			SLOPE 
			SMALL 
			SQRT 
			SUBSTITUTE
			SUM 
			SUMIF 
			SUMPRODUCT 
			SUMSQ 
			SYD 
			TAN 
			TIME 
			TREND 
			TRIM 
			TEXT 
			TODAY 
			TRUNC 
			UPPER 
			VALUE 
			VDB 
			VLOOKUP 
			WORKDAY 
			YEAR
		].sort
	end
	
end

Coverage.new.run()
